home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / cnet / aandm next >
Text File  |  1994-07-02  |  28KB  |  719 lines

  1. /*===========================================================================
  2.                   ___  __ _  ___  _    _     __ __  ___  _  
  3.                  | _ ||  | || __|| |   \)   |  |  ||  _|| |
  4.    >-------------|   ||    ||__ || |   /\,  |     || |_ | | -------------<
  5.                  |_|_||_|__||___||_|  (_/\  |_|_|_||___||_|    v2.00
  6.          an AberDeen Foxx release:  "MCI<ANSI" & "ANSI<MCI" combined
  7.  
  8. ================================== (\(\ =====================================
  9.  complete merge by:  SideWinder   (OO ") __          September 15, 1993
  10.                                 =('-=  )/~_)        <MISC> Entertainment
  11.                          +---oOO-----OOo---+       voice:  (805) 399-1500
  12.                          |  AberDeen Foxx  |   Missing Links:  (805) 399-3500
  13. ======================== +-----------------+ ================================
  14.       þ An ANSI to MCI text file conversion program for CNet Amiga files.
  15.       þ Converts many ANSI commands, the rest have no MCI equivalent.
  16.       þ An MCI to ANSI text file conversion program for CNet Amiga files.
  17.       þ Converts many MCI commands, the rest have no ANSI equivalent.
  18.       þ Simple viewer for MCI or ANSI, on CNet BBS or in CLI.
  19.       þ Will strip/add carriage returns and/or strip all ANSI and MCI codes.
  20.       þ Freely distributable software, no shareware fee!
  21.       þ Works either from CNet command, Pfiles, Gfiles, or CLI/Shell.
  22.       þ Full help in file, hit ? at prompts or use ? as an argument.
  23. ===========================================================================*/
  24.  
  25. options results
  26. signal on error
  27. signal on syntax
  28. call pragma('W','N')
  29. cr="0d0a"x;COLORD=15 /*** Set COLORD to your default CNet color (0-15) ***/
  30.  
  31. getuser 70
  32. cnet=1
  33. wrdin=""
  34. input=""
  35. addkeys cr||cr
  36. do until wrdin=""
  37.   input=input||wrdin
  38.   wrdin=gt("")" "
  39. end
  40. bufferflush
  41.  
  42. choice:
  43.  
  44.    backd=0;defset="0000"b /* bright, underline, bold, reverse */
  45.    atoz="ABCDEFGHIJKLMNOPQRSTUVWXYZ";ztoz="0123456789abcdefghijklmnopqrstuvwxyz"
  46.    errors="";overwr=0;silent=0;nostat=0;linefd=0;viewer=0;from="";two=""
  47.  
  48.    if index("-/\:=+|><",left(word(input,1),1))~=0 then do
  49.       switch=upper(substr(word(input,1),2))
  50.       input=delword(input,1,1)
  51.       if (index(switch,"{")~=0|index(switch,"M")~=0) & from="" then do;from="ANSI";two="MCI";leader="";erase=2;end
  52.       if (index(switch,"[")~=0|index(switch,"A")~=0) & from="" then do;from="MCI";two="ANSI";leader="";erase=1;end
  53.       if (index(switch,":")~=0|index(switch,"S")~=0) & from="" then do;from="STRIP";two="ASCII";leader="";erase=2;end
  54.       if (index(switch,"^")~=0|index(switch,"N")~=0) & from="" then do;from="NULL";if two~="CRS" then two="NCR";leader="";erase=0;end
  55.       if index(switch,"!")~=0|index(switch,"O")~=0 then overwr=1
  56.       if index(switch,"@")~=0|index(switch,"L")~=0 then do;if two="NCR"|two="" then two="CRS";linefd=1;end
  57.       if index(switch,"#")~=0|index(switch,"R")~=0 then nostat=1
  58.       if index(switch,"$")~=0|index(switch,"Q")~=0 then silent=1
  59.       if index(switch,"%")~=0|index(switch,"V")~=0 then viewer=1
  60.    end
  61.  
  62.    call tr()
  63.  
  64.    if word(input,1)="?" | word(input,1)="HELP" then call arghelp
  65.  
  66.    do while from=""
  67.       do until index("AMSVRP?",temp)~=0
  68.          call tr(cr"Please select correct conversion method."cr"M=ANSItoMCI, A=MCItoANSI, S=Strip, V=View, R=Remove, P=Put, ?=Help, RETURN=Exit")
  69.          temp=upper(left(gt("METHOD: "),1))
  70.          if temp="" then signal exiter
  71.       end
  72.       select
  73.          when temp="M" then do;from="ANSI";two="MCI";leader="";erase=2;end
  74.          when temp="A" then do;from="MCI";two="ANSI";leader="";erase=1;end
  75.          when temp="S" then do;from="STRIP";two="ASCII";nostat=1;leader="";erase=2;end
  76.          when temp="V" then do;from="NULL";two="VIEW";viewer=1;nostat=1;end
  77.          when temp="R" then do;from="NULL";two="NCR";linefd=0;end
  78.          when temp="P" then do;from="NULL";two="CRS";linefd=1;end
  79.          when temp="?" then call selecthelp
  80.       otherwise signal exiter
  81.       end
  82.       drop temp
  83.       call tr()
  84.    end
  85.  
  86.    if colord>7 then do
  87.       dolord=colord-8
  88.       defset=bitset(defset,3)
  89.    end
  90.    color=999;back=999;mainset="1111"x
  91.    colort=colord;backt=backd;tempset=defset
  92.  
  93.    number=words(input)
  94.  
  95.    if number<1 then filein=gt(cr"Enter name of "from" text file for input.  Enter '?' for help."cr"FROM: ")
  96.    else filein=word(input,1)
  97.    if filein="" then signal exiter
  98.    do while ~exists(filein)
  99.       if filein="?" | upper(filein)="HELP" then filein=help()
  100.       else filein=tr(cr"The file '"upper(filein)"' does not exist, check for correct spelling and path. (?=help)")gt("FROM: ")
  101.    end
  102.    if filein="" then signal exiter
  103.    if viewer=0 then do
  104.       if number>1 then fileout=word(input,2)
  105.       else do
  106.          choice=filein||"."||left(two,3)
  107.          fileout=tr(cr"Choose output file.  [Hit RETURN for '"choice"']")gt("TO  : ")
  108.          if fileout="" then fileout=choice
  109.       end
  110.       choice=fileout
  111.       do while exists(choice)
  112.          if overwr=1 | choice2="!" then do
  113.             if choice=filein then call tr("You can't overwrite the INPUT file!")
  114.             else do
  115.                choice2="!"
  116.                leave
  117.             end
  118.          end
  119.          call tr(cr"The output file '"upper(choice)"' already exists!")
  120.          choice2=tr("Enter new output file, or type '!' to overwrite.")gt("TO  : ")
  121.          if choice2="" then signal exiter
  122.          if choice2~="!" then choice=choice2
  123.       end
  124.       fileout=choice
  125.       if choice2="!" then choice=choice||" (overwriting)"
  126.       call tr("Converting:  "filein" --> "choice"")
  127.       if cnet=0 & silent=0 then call tr("Warning: Colors & Font may not LOOK correct when run from CLI, but they are.")
  128.       drop choice number
  129.       if ~open(out,fileout,"W") then signal error
  130.    end
  131.  
  132.    if ~open(in,filein,"R") then signal error
  133.    line=readln(in)
  134.    do n=1 until eof(in)
  135.       remb=line
  136.       call search()
  137.       if linefd=1 then line=line||"0d"x
  138.       if viewer=0 then call writeln(out, line)
  139.       if cnet=0 & two="MCI" then line=remb
  140.       if silent=0 then call tr(line)
  141.       line=readln(in)
  142.    end
  143.    if viewer=0 then call tr(cr"Conversion Complete...")
  144.    if nostat=0 then do
  145.       if errors~="" then do
  146.          call tr(cr"Conversion was NOT completely successful...  Picture distortion may result."cr"")
  147.          call tr(errors)
  148.       end
  149.       else call tr(cr"No conversion errors detected.")
  150.    end
  151.    signal exiter
  152.  
  153. search:
  154.  
  155.    where=1
  156.    if from~="NULL" then do
  157.       if from="MCI" | from="STRIP" then do until where=0
  158.          where=index(line,"",where)
  159.          if where~=0 then do
  160.             line=overlay("",line,where)
  161.             line=insert("}",line,where+2,1)
  162.          end
  163.       end
  164.       where=1
  165.       if from="STRIP" then do until where=0
  166.          where=index(line,"",where)
  167.          if where~=0 then do
  168.             test=substr(line,where+1,1)
  169.             if test=">" then do
  170.                end=index(line,"}",where)
  171.                if end~=0 then do
  172.                   test=substr(line,where+2,end-where-2)
  173.                   test=let2num(test)
  174.                   line=insert(""test"C",line,end)
  175.                end
  176.             end
  177.             end=index(line,"}",where)
  178.             if end~=0 then line=delstr(line,where,end-where+1)
  179.          end
  180.       end
  181.       where=1
  182.       do until where=0
  183.          where=index(line,leader,where)
  184.          if where~=0 then do
  185.             line=delstr(line,where,erase)
  186.             temp=convert(substr(line,where))
  187.             line=delstr(line,where)||temp
  188.          end
  189.       end
  190.    end
  191.    if line ~="" then where=index(line,"0d"x,length(line))
  192.    if where ~=0 then line=delstr(line,where,1)
  193.    return ""
  194.  
  195. convert:
  196.  
  197.    parse arg work
  198.    found=0
  199.    if two="ANSI" then do
  200.       do x=1 until found~=0
  201.          work2=substr(work,x,1)
  202.          if work2="}" then found=1
  203.          if found=0 & (work2="" | x>length(work)) then do
  204.             if nostat=0 then errors=errors||"Line "n".  Could not locate end of MCI command, skipped, may cause garbage."cr
  205.             return work
  206.          end
  207.       end
  208.       command=left(work,1)
  209.       work2=substr(work,2,x-2)
  210.       work=substr(work,x+1)
  211.       found=index("BCFHNOQRUZ^!><-*P:@AGIJKLMSTVWX#$?=n",upper(command))
  212.       if found=0 then do
  213.          if command~<"0" & command~>"9" then found=36
  214.          else do
  215.             if nostat=0 then errors=errors||"Line "n".  Undetermined MCI command, skipped, may cause garbage."cr
  216.             return work
  217.          end
  218.       end
  219.    end
  220.    else do
  221.       problem=1
  222.       do x=1 until found~=0
  223.          work2=substr(work,x,1)
  224.          found=index("mFAEBCD@JLMKPtSTxyfHsu",work2)
  225.          if found=0 & two~="ASCII" then problem=index("0123456789 ;",work2)
  226.          if problem=0 | x>length(work) then do
  227.             if nostat=0 then errors=errors||"Line "n".  Undetermined ANSI command, skipped, may cause garbage."cr
  228.             return work
  229.          end
  230.       end
  231.       work2=left(work,x-1)
  232.       if work2>0 then work2=translate(work2," ",";")
  233.       work=substr(work,x+1)
  234.    end
  235.    if two="ASCII" then do
  236.       space=""
  237.       if found=6 then do
  238.          if work2="" then space=" "
  239.          else do for work2
  240.             space=space||" "
  241.          end
  242.       end
  243.       return space||work
  244.    end
  245.    signal value two||found
  246.  
  247. ansi1:  /* B - Bells             */
  248.  
  249.    work2=let2num(work2)
  250.    count=""
  251.    if work2=0 then return work
  252.    do for work2
  253.       count=count||"07"x
  254.    end
  255.    return count||work
  256.  
  257. ansi2:  /* C - Foreground Color  */
  258.  
  259.    work2=let2num(work2)
  260.    if work2~<0 & work2~>15 then do
  261.       if work2<8 then tempset=bitclr(tempset,3)
  262.       else do
  263.          tempset=bitset(tempset,3)
  264.          work2=work2-8
  265.       end
  266.       colort=work2
  267.       signal attributes
  268.    end
  269.    if nostat=0 then errors=errors||"Line "n".  {Cn} On foreground color 'n' was not within range of 0-15."cr
  270.    return work
  271.  
  272. ansi3:  /* F - Home & Clear      */
  273.  
  274.    select
  275.       when work2=0 then return "H"||work
  276.       when work2=1 then return ""||work
  277.    otherwise
  278.       if nostat=0 then errors=errors||"Line "n".  {Fn} On Home & Clear 'n' was not within range of 0-1."cr
  279.    end
  280.    return work
  281.  
  282. ansi4:  /* H - Backspaces        */
  283.  
  284.    work2=let2num(work2)
  285.    if work2=0 then return work
  286.    if work2=1 then return "DP"work
  287.    return ""work2"D"work2"P"work
  288.  
  289. ansi5:  /* N - New Lines (CR)    */
  290.  
  291.    work2=let2num(work2)
  292.    if work2=0 then return work
  293.    if work2=1 then return cr||work
  294.    return ""work2"E"work
  295.  
  296. ansi6:  /* O - Bold/Flashing     */
  297.  
  298.    if work2=0 then tempset=bitclr(tempset,1)
  299.    else tempset=bitset(tempset,1)
  300.    signal attributes
  301.  
  302. ansi7:  /* Q - ANSI Settings     */
  303.  
  304.    if work2=1 then do
  305.       tempset="0000"x;colort=7;backt=0
  306.    end
  307.    else do
  308.       if color~=999 then do;tempset=mainset;colort=color;backt=back;end
  309.       force=1
  310.    end
  311.    signal attributes
  312.  
  313. ansi8:  /* R - Reverse           */
  314.  
  315.    if work2=0 then tempset=bitclr(tempset,0)
  316.    else tempset=bitset(tempset,0)
  317.    signal attributes
  318.  
  319. ansi9:  /* U - Underline Mode    */
  320.  
  321.    if work2=0 then tempset=bitclr(tempset,2)
  322.    else tempset=bitset(tempset,2)
  323.    signal attributes
  324.  
  325. ansi10: /* Z - Background Color  */
  326.  
  327.    if work2~<"0" & work2~>"7" then do
  328.       backt=work2
  329.       signal attributes
  330.    end
  331.    if nostat=0 then errors=errors||"Line "n".  {Zn} On background color 'n' was not within range of 0-7."cr
  332.    return work
  333.  
  334. ansi11: /* ^ - Cursor Up         */
  335.  
  336.    work2=let2num(work2)
  337.    if work2=0 then return work
  338.    if work2=1 then return "A"work
  339.    return ""work2"A"work
  340.  
  341. ansi12: /* ! - Cursor Down       */
  342.  
  343.    work2=let2num(work2)
  344.    if work2=0 then return work
  345.    if work2=1 then return "B"work
  346.    return ""work2"B"work
  347.  
  348. ansi13: /* > - Cursur Right      */
  349.  
  350.    work2=let2num(work2)
  351.    if work2=0 then return work
  352.    if work2=1 then return "C"work
  353.    return ""work2"C"work
  354.  
  355. ansi14: /* < - Cursor Left       */
  356.  
  357.    work2=let2num(work2)
  358.    if work2=0 then return work
  359.    if work2=1 then return "D"work
  360.    return ""work2"D"work
  361.  
  362. ansi15: /* - - Insert Characters */
  363.  
  364.    work2-let2num(work2)
  365.    if work2=0 then return work
  366.    if work2=1 then return "@"work
  367.    return ""work2"@"work
  368.  
  369. ansi16: /* * - Display File      */
  370. ansi17: /* P - Print Mode        */
  371. ansi18: /* : - Auto indention    */
  372. ansi19: /* @ - MCI variable      */
  373. ansi20: /* A - Message Abortion  */
  374. ansi21: /* G - Get a key         */
  375. ansi22: /* I - Input a line      */
  376. ansi23: /* J - Jump to label     */
  377. ansi24: /* K - Kolorific         */
  378. ansi25: /* L - Load variable     */
  379. ansi26: /* M - Math Function     */
  380. ansi27: /* S - Slow              */
  381. ansi28: /* T - Test Variable     */
  382. ansi29: /* V - System Variable   */
  383. ansi30: /* W - Pause             */
  384. ansi31: /* X - Replace           */
  385. ansi32: /* # - Run ARexx         */
  386. ansi33: /* $ - Send AmigDOS      */
  387. ansi34: /* ? - Wait For Yes/No   */
  388. ansi35: /* = - Set to Yes/No     */
  389. ansi36: /* n - Label             */
  390.  
  391.    if nostat=0 then errors=errors||"Line "n".  No ANSI substitute for MCI's {"substr('*P:@AGIJKLMSTVWX#$?=n',found-15,1)||work2"}."cr
  392.    return work
  393.  
  394. attributes:
  395.  
  396.    work2=""
  397.    do step=0 to 3
  398.       if (bittst(mainset,step) & bittst(tempset,step) ~= bittst(mainset,step)) | force=1 then do
  399.          mainset="0000"x;color=7;back=0
  400.          work2="0;"
  401.          leave
  402.       end
  403.    end
  404.    force=0
  405.    if bittst(tempset,3)=1 & bittst(mainset,3)=0 then work2=work2||"1;"
  406.    if bittst(tempset,2)=1 & bittst(mainset,2)=0 then work2=work2||"4;"
  407.    if bittst(tempset,1)=1 & bittst(mainset,1)=0 then work2=work2||"5;"
  408.    if bittst(tempset,0)=1 & bittst(mainset,0)=0 then work2=work2||"7;"
  409.    if colort~=color then work2=work2||"3"||colort||";"
  410.    if backt~=back then work2=work2||"4"||backt||";"
  411.    color=colort;back=backt;mainset=tempset
  412.    if right(work2,1)=";" then work2=left(work2,length(work2)-1)
  413.    if work2="" then return work
  414.    work2=""||work2||"m"
  415.    return work2||work
  416.  
  417.  
  418. mci1:  /* m - Screen Display    */
  419.  
  420.    number=words(work2)
  421.    if number>0 then do count=1 to number
  422.       work3=word(work2,count)
  423.       select
  424.          when work3=0 then do
  425.             colort=7;backt=0
  426.             tempset="0000"b
  427.          end
  428.          when work3=1 then tempset=bitset(tempset,3)
  429.          when work3=4 then tempset=bitset(tempset,2)
  430.          when work3=5 then tempset=bitset(tempset,1)
  431.          when work3=7 then tempset=bitset(tempset,0)
  432.       otherwise
  433.          forb=left(work3,1)
  434.          select
  435.             when forb=3 then colort=right(work3,1)
  436.             when forb=4 then backt=right(work3,1)
  437.             when forb=6 then backt=right(work3,1)
  438.          otherwise if nostat=0 then errors=errors||"Line "n".  Unknown Screen Display Mode:  Skipped."cr
  439.          end
  440.       end
  441.    end
  442.    work2=""
  443.    if colort=colord & backt=backd & tempset=defset then do
  444.       if colort=color & backt=back & tempset=mainset then work2=""
  445.       else work2="q1"
  446.    end
  447.    else do
  448.       if colort+(bittst(tempset,3)*8)~=color+(bittst(mainset,3)*8) then work2="c"||substr(ztoz,1+colort+(bittst(tempset,3)*8),1)
  449.       if backt~=back then work2=work2||"z"||substr(ztoz,1+backt,1)
  450.       if bittst(tempset,2)~=bittst(mainset,2) then work2=work2||"u"||bittst(tempset,2)
  451.       if bittst(tempset,1)~=bittst(mainset,1) then work2=work2||"o"||bittst(tempset,1)
  452.       if bittst(tempset,0)~=bittst(mainset,0) then work2=work2||"r"||bittst(tempset,0)
  453.    end
  454.    color=colort;back=backt;mainset=tempset
  455.    return work2||work
  456.  
  457. mci2:  /* F - Cursor Up & LF    */
  458.  
  459.    if work2="" then work2="^2n1"
  460.    else do
  461.       if work2>34 then work2="^"||work2+1||"}n1"
  462.       else work2="^"||substr(ztoz,2+work2,1)||"n1"
  463.    end
  464.    return work2||work
  465.  
  466. mci3:  /* A - Cursor Up         */
  467.  
  468.    if work2="" then work2="^1"
  469.    else do
  470.       if work2>35 then work2="^"||work2||"}"
  471.       else work2="^"||substr(ztoz,1+work2,1)
  472.    end
  473.    return work2||work
  474.  
  475. mci4:  /* E - Cursor Down & LF  */
  476.  
  477.    if work2="" | work2=1 then work2="n1"
  478.    else do
  479.       if work2>35 then work2="n"||work2||"}"
  480.       else work2="n"||substr(ztoz,1+work2,1)
  481.    end
  482.    return work2||work
  483.  
  484. mci5:  /* B - Cursor Down       */
  485.  
  486.    if work2="" then work2="!1"
  487.    else do
  488.       if work2>35 then work2="!"||work2||"}"
  489.       else work2="!"||substr(ztoz,1+work2,1)
  490.    end
  491.    return work2||work
  492.  
  493. mci6:  /* C - Cursor Right      */
  494.  
  495.    if work2="" then work2=">1"
  496.    else do
  497.       if work2>35 then work2=">"||work2||"}"
  498.       else work2=">"||substr(ztoz,1+work2,1)
  499.    end
  500.    return work2||work
  501.  
  502. mci7:  /* D - Cursor Left       */
  503.  
  504.    if work2="" then work2="<1"
  505.    else do
  506.       if work2>35 then work2="<"||work2||"}"
  507.       else work2="<"||substr(ztoz,1+work2,1)
  508.    end
  509.    return work2||work
  510.  
  511. mci8: /* @ - Insert Characters */
  512.  
  513.    if work2="" | work2=1 then work2="-1"
  514.    else do
  515.       if work2>35 then work2="-"||work2||"}"
  516.       else work2="-"||substr(ztoz,1+work2,1)
  517.    end
  518.    return work2||work
  519.  
  520. mci9:  /* J - Erase  Screen     */
  521.  
  522.    if work2~=2 & nostat=0 then do
  523.       if work2>0 then work2=translate(work2,";"," ")
  524.       errors=errors||"Line "n".  Substituted esc[2J (\f1) for esc["work2"J."cr
  525.    end
  526.    return "f1"||work
  527.  
  528. mci10: /* L - Insert Lines      */
  529. mci11: /* M - Delete Lines      */
  530. mci12: /* K - Erase  Lines      */
  531. mci13: /* P - Delete Characters */
  532. mci14: /* t - Set Bottom Border */
  533. mci15: /* S - Slide  Up         */
  534. mci16: /* T - Slide  Down       */
  535. mci17: /* x - Pixels Right      */
  536. mci18: /* y - Pixels Down       */
  537. mci19: /* f - Vector Row & Col  */
  538. mci20: /* H - Vector Row & Col  */
  539. mci21: /* s - Save   Row & Col  */
  540. mci22: /* u - Use    Row & Col  */
  541.  
  542.    if work2>0 then work2=translate(work2,";"," ")
  543.    if nostat=0 then errors=errors||"Line "n".  No MCI substitute for ANSI's esc["work2||substr('LMKPtSTxyfHsu',found-9,1)"."cr
  544.    return work
  545.  
  546. gt:
  547.  
  548.    if cnet=0 then do
  549.       options prompt arg(1)
  550.       parse pull z
  551.       options prompt
  552.    end
  553.    else do
  554.       prompt 40 normal arg(1)
  555.       z=result
  556.       if z="###PANIC" then signal exiter
  557.    end
  558.    return z
  559.  
  560. tr:
  561.  
  562.    parse arg string
  563.    if cnet=0 then say string
  564.    else transmit string
  565.    return ""
  566.  
  567. let2num:
  568.  
  569.    parse arg what
  570.    if length(what)>1 then return what
  571.    if what~<"0" & what~>"9" then return what
  572.    num=index(atoz,upper(what))+9
  573.    if num>9 then return num
  574.    return what
  575.  
  576. help:
  577.    call tr(cr'ANSI-and-MCI v2.0 (completely written and merged by AberDeen Foxx, 9-93)')
  578.    call tr(cr'   You will need to enter a file name to be used as an input file.  The file')
  579.    call tr('should specify the correct path to locate the file in.  It is possible to run')
  580.    call tr('this "A&M" program from CLI in the directory where you will be converting; in')
  581.    call tr('this situation you would NOT have to enter the path.')
  582.    call tr(cr'   You will then need to enter a file name to be used as an output file, IF')
  583.    call tr('you are converting.  If you are NOT converting, no filename will be asked for a')
  584.    call tr('destination.  The only time this will be true is when you are VIEWing a text file.')
  585.    call tr(cr'   If you are interested in learning more tricks to A&M, exit the program')
  586.    call tr('and enter "RX A&M ?" and an argument help file will be displayed.')
  587.    call bothhelp
  588.    call helptag
  589.    return gt(cr"Enter name of "from" text file for input.  RETURN to abort."cr"FROM: ")
  590.  
  591. arghelp:
  592.    call tr(cr'ANSI-and-MCI v2.0 (completely written and merged by AberDeen Foxx, 9-93)')
  593.    call tr('You may select arguments from either CNET or CLI as follows:')
  594.    call tr('CLI :  RX A&M [-{AMSOLRQVN}] [path:input.file] [path:output.file]')tr('    :')
  595.    call tr("    :[] optional, METHOD, FROM & TO will be asked if you don't enter args.")
  596.    call tr("    :Switches: M or { -Selects ANSI-to-MCI conversion process.")
  597.    call tr("    :          A or [ -Selects MCI-to-ANSI conversion process.")
  598.    call tr("    :          S or : -Will Strip out all ANSI and MCI codes, save as ASCII.")
  599.    call tr("    :          N or ^ -Null, no convertion, except for carriage returns.")
  600.    call tr("    :        / O or ! -Forces it to overwrite output.file, it won't ask.")
  601.    call tr('    : in    /  L or @ -Append a carriage return character to end of lines.')
  602.    call tr("    : any  <   R or # -Turn off error recording, won't tell what went wrong.")
  603.    call tr('    : order \  Q or $ -Force quiet operation, does not show conversion.')
  604.    call tr("    :        \ V or % -View file only...  Will not save to a destination.")
  605.    call tr('ExamplesRX A&M -A@!$ ram:mcipic ram:ansiout')
  606.    call tr('        RX A&M ram:mcipic ram:ansiout')
  607.    call tr('        RX A&M -$M ram:ansipic')
  608.    call tr('        RX A&M ram:mcipic')
  609.    call tr('        RX A&M -!V#')
  610.    call tr('        RX A&M')
  611.    call gt(cr'<more> hit return: ')
  612.    call tr(cr'CNET:  RUNA;A&M;[-{AMSOLRQVN}];[path:input.file];[path:output.file]')tr('    :')
  613.    call tr('    :    "RUNA;A&M" could be another command to envoke the rexx program A&M.')
  614.    call tr('    :    It could be either in a new bbsmenu command, or Pfiles/Gfiles.')
  615.    call tr('ExamplesRUNA;A&M;-A@!$;ram:mcipic;ram:ansiout {with RunArexx Command}')
  616.    call tr('        CONVERT;ram:mcipic;ram:ansiout        {using new BBS Command}')
  617.    call tr('        5;-$M;ram:ansipic                     {from Pfiles or Gfiles}')
  618.    call tr('        RUNA;A&M;ram:mcipic                   {with RunArexx Command}')
  619.    call tr('        CONVERT;-!V#                          {using new BBS Command}')
  620.    call tr('        5                                     {from Pfiles or Gfiles}')
  621.    call tr(cr'   A quick word about argument switches...  Switches "M, A, S, and N" are')
  622.    call tr('overriding in that order.  If an "M" is given it will override all others,')
  623.    call tr('"A, S, and N."  Entering a "A" would override the "S" and "N" but not the')
  624.    call tr('"M".  For reasons of clarity, you should only use one of these switches at')
  625.    call tr('a time; it won''t help to use more.  The other switches, "O, L, R, Q, and V"')
  626.    call tr('are able to be used in any order and as many as wanted.  These rules also')
  627.    call tr('apply to their counterparts, "{, [, :, ^, !, @, #, $, and %"')
  628.    call bothhelp
  629.    call helptag
  630.    exit
  631.  
  632. bothhelp:
  633.    call gt(cr'<more> hit return: ')
  634.    call tr(cr'   Switches have been added to speed up conversion, a little, and also add')
  635.    call tr('utilities to view without making a new file, strip all MCI and ANSI codes for')
  636.    call tr('ASCII, and add or remove carriage returns to the end of every line in a file.')
  637.    call tr('   The Rexx program A&M should be in your Arexx directory so paths will')
  638.    call tr('not have to be specified.  However, if you are using the RunArexx program')
  639.    call tr("(RUNA) then you will need to specify REXX: as the path.")
  640.    call tr('   Another nice feature of WorkBench is ALIASing...  If you use this program')
  641.    call tr('a lot from CLI/Shell, put lines like these in the s:shell-startup.  These')
  642.    call tr("will allow you to just enter 'a2m' or 'm2a' instead of 'rx a&m -???'.")
  643.    call tr('     ALIAS a2m "rx a&m -M"')
  644.    call tr('     ALIAS m2a "rx a&m -A"')
  645.    call tr('     ALIAS viewtext "rx a&m -NV"')
  646.    call tr('     ALIAS addcr "rx a&m -NL"')
  647.    call tr("   Note:  When using 'A&M' on CNet, the conversion output is a true converted")
  648.    call tr('output.  This means that you are seeing the file as it will look when')
  649.    call tr('converted.  When run on CLI/Shell the output will always be ANSI, if you')
  650.    call tr('are converting to MCI from CLI/Shell then output will be the original ANSI.')
  651.    call tr('ANSI will view correctly, excepting the Workbench Colors and Fonts.  Final')
  652.    call tr('output into file will be correct, however.')
  653.    return
  654.  
  655. helptag:
  656.    call gt(cr'<more> hit return: ')
  657.    call tr(cr'   This program is fully distributable public domain.  I do ask that')
  658.    call tr('you register use of this program by writing your name, address, phone and')
  659.    call tr("any comments about 'A&M' by sending it to me at one of the places below.")
  660.    call tr('This is also where you can send BUG reports...')
  661.    call tr(cr'   MISSING LINKS BBS, (805) 399-3500, 399-2500 V.FC, OWNER: AberDeen Foxx.')
  662.    call tr('   FUTURE WORLD BBS,  (313) 255-2464, 2465, or 2466,  USER: AberDeen Foxx.')
  663.    call tr(cr'   Or if you would like to be sent information about updates or other')
  664.    call tr('programs then send one dollar (US currency, no check or money order, even')
  665.    call tr('though the Post Office may say differently) to:')
  666.    call tr('                                                           (\(\')
  667.    call tr('   <MISC> Entertainment                                   (OO ") __')
  668.    call tr("   Attn:  AberDeen Foxx                                 =(' -= )/~_)")
  669.    call tr('                                                 +----oOO---OOo----+')
  670.    call tr('   120 Washington Ave. #1                        |  AberDeen Foxx  |')
  671.    call tr('   Bakersfield, Ca  93308-3459                   +-----------------+'cr)
  672.    return
  673.  
  674. selecthelp:
  675.    call tr(cr'ANSI-and-MCI v2.0 (completely written and merged by AberDeen Foxx, 9-93)')
  676.    call tr(cr'   You may choose one of the following responses from the METHOD: prompt.')
  677.    call tr(cr'      A =  MCI to ANSI - to convert a text file with MCI codes in it to')
  678.    call tr('                         an ANSI coded text file.')
  679.    call tr('      M =  ANSI to MCI - to convert a text file with ANSI codes in it to')
  680.    call tr('                         an CNet MCI coded text file.')
  681.    call tr('      S =  STRIP FILE  - will remove all MCI or ANSI codes, thereby')
  682.    call tr('                         creating plain monochrome ASCII.')
  683.    call tr('      V =  VIEW FILE   - only view file given, will not convert and')
  684.    call tr('                         will not create another destination file.')
  685.    call tr('      R =  REMOVE      - Remove Carriage Returns from the end of each line')
  686.    call tr('                         in the text file named, saves as a different file.')
  687.    call tr('      P =  PUT         - Opposite of REMOVE, this will add Carriage Returns')
  688.    call tr('                         to the end of every line in a file, with save.')
  689.    call gt(cr'<more> hit return: ')
  690.    call tr(cr'   Another way to choose is to use arguments when you run A&M.  Like so:')
  691.    call tr(cr'  RX A&M -A (or -[)    - Select convert MCI to ANSI.')
  692.    call tr('  RX A&M -M (or -{)    - Select convert ANSI to MCI.')
  693.    call tr('  RX A&M -S (or -:)    - Select Strip all to ASCII.')
  694.    call tr('  RX A&M -O (or -!)    - Force overwrite on output file.')
  695.    call tr('  RX A&M -L (or -@)    - Append carriage return to end of lines.')
  696.    call tr('  RX A&M -R (or -#)    - Turn off error recording.')
  697.    call tr("  RX A&M -Q (or -$)    - Quiet mode, don't show conversion on screen.")
  698.    call tr('  RX A&M -V (or -%)    - View file only.  No save to destination.')
  699.    call tr("  RX A&M -N (or -^)    - Null, don't change anything, except CR's. (Null")
  700.    call tr('                           must be used to remove or append carriage')
  701.    call tr('                           returns only.  Otherwise it will convert.)')
  702.    call tr(cr'For furthur info about ARGUMENTS, exit program and enter "RX A&M ?".')
  703.    call helptag
  704.    return
  705.  
  706. exiter:
  707.    call tr("")close(in)close(out)
  708.    exit
  709.  
  710. syntax:
  711. error:
  712.    if rc=5 & cnet="CNET" then do
  713.       parse arg input
  714.       cnet=0
  715.       signal choice
  716.    end
  717.    call tr("LINE : "sigl||cr||sourceline(sigl)||cr||'ERROR: 'rc', 'errortext(rc))
  718.    signal exiter
  719.